package com.special.threademo.spring;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;

/**
 * Created with IDEA2020.3
 * author:LiuYC
 * DateTime:2021/1/7  22:35
 */
public class SourceTest {
    public static void main(String[] args) {
        ClassPathResource classPathResource = new ClassPathResource("ApplicationContext.xml");
        DefaultListableBeanFactory defaultListableBeanFactory = new DefaultListableBeanFactory();
        XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(defaultListableBeanFactory);
        xmlBeanDefinitionReader.loadBeanDefinitions(classPathResource);
        Student student = (Student) defaultListableBeanFactory.getBean("Student");
        System.out.println(student.getAge());
        System.out.println(student.getName());

    }

}
